<?php
/**
 * SocialEngine
 *
 * @category   Application_Extensions
 * @package    Quiz
 * @copyright  Copyright Hire-Experts LLC
 * @license    http://www.hire-experts.com
 * @version    $Id: view.tpl 2010-07-02 17:53 ermek $
 * @author     Ermek
 */
?>
<style type="text/css">
#submit_contacts-wrapper{
	clear: both;
}
</style>

<script type='text/javascript'>

en4.core.runonce.add(function() {
  provider.set_enabled('Facebook', <?php echo ($this->facebookKey) ? 1 : 0 ?>);
  provider.set_enabled('Twitter', <?php echo ($this->twitterKey) ? 1 : 0 ?>);
  provider.set_enabled('LinkedIn', <?php echo ($this->linkedinKey) ? 1 : 0 ?>);
  provider.set_enabled('GMail', <?php echo ($this->gmailKey) ? 1 : 0 ?>);

  provider.oauth_url = "<?php echo $this->url(array('module' => 'inviter', 'controller' => 'oauth', 'action' => 'request', 'format' => 'smoothbox'), 'default') ?>";
});

suggest.current_suggests = <?php echo Zend_Json::encode($this->current_suggests); ?>;

en4.core.runonce.add(function()
{
  if ($('separator2-label') != undefined)
  {
    $('separator2-label').getParent('li').destroy();
  }

  if ($('inviter-uploader-form') != undefined)
  {
  	$('inviter-uploader-form').slide('hide').slide('out');
  }

  if ($('inviter-writer-form') != undefined)
  {
  	$('inviter-writer-form').slide('hide').slide('out');
  }
});

function tab_slider($tab)
{
	$$('.inviter-form-cont').removeClass('inviter-form-bg');
	$$('.inviter-form-cont').removeClass('inviter-form-hover');
	$$('.inviter-form').slide('hide').slide('out');
	$$('.inviter-tab-title').addClass('inviter-form-title');

	$('inviter-'+$tab+'-form').slide('hide').slide('in');
	$('inviter-'+$tab+'-title').removeClass('inviter-form-title');
	$('inviter-'+$tab+'-conteiner').addClass('inviter-form-bg');
}

function changeFields()
{
  
}

function searchMembers()
{
  $('field_search_criteria').submit();
}

function show_creation_description(id)
{
	if ($(id).hasClass('creation_item_hide')){
		$(id).removeClass('creation_item_hide');
	} else {
		$(id).addClass('creation_item_hide');	
	}
}
</script>

<div class='layout_right'>
  <?php
    $viewer = Engine_Api::_()->user()->getViewer();
    if (!$this->form->_signup):
  ?>
      <h3><?php echo $this->translate('INVITER_Find Your Friends'); ?></h3>
      <?php
      echo $this->form_search->render($this);
    endif; 
  ?>
</div>

<div class='layout_middle'>

<?php if (!$this->form->_signup && $viewer->getIdentity()): ?>
	<div class="headline">
	  <div class="tabs">
	    <?php
	      // Render the menu
      echo $this->navigation()
        ->menu()
        ->setContainer($this->navigation)
        ->render();
    	?>
	  </div>
	</div>
<?php endif; ?>

<div class='inviter-forms-conteiner global_form'>
<div>
	<div>
	<div class='inviter-form-cont inviter-form-bg' id='inviter-importer-conteiner'>
		<div id='inviter-importer-title' class="inviter-tab-title inviter-import-title"
			onclick="if ($(this).hasClass('inviter-form-title')){tab_slider('importer');}"
			onmouseover="if ($(this).hasClass('inviter-form-title')){$('inviter-importer-conteiner').addClass('inviter-form-hover')}"
			onmouseout="if ($(this).hasClass('inviter-form-title')){$('inviter-importer-conteiner').removeClass('inviter-form-hover')}">
			<h3 style="padding: 20px;"><?php echo $this->translate('INVITER_Import Your Contacts')?></h3>
		</div>
		<div class='inviter-form' id='inviter-importer-form' > <?php echo $this->form->render($this)?> </div>
	</div>

	<?php if ($this->viewer->getIdentity()):?>
	<div class='inviter-form-conteiner inviter-form-cont' id='inviter-uploader-conteiner'>
		<div id='inviter-uploader-title' class='inviter-tab-title inviter-upload-title inviter-form-title'
			onclick="if ($(this).hasClass('inviter-form-title')){tab_slider('uploader');}"
			onmouseover="if ($(this).hasClass('inviter-form-title')){$('inviter-uploader-conteiner').addClass('inviter-form-hover')}"
			onmouseout="if ($(this).hasClass('inviter-form-title')){$('inviter-uploader-conteiner').removeClass('inviter-form-hover')}">
			<h3 style="padding: 20px;"><?php echo $this->translate('INVITER_Upload Your Contacts')?></h3>
		</div>
		<div class='inviter-form' id='inviter-uploader-form'> <?php echo $this->form_upload->render($this)?> </div>
	</div>

	<div class='inviter-form-conteiner inviter-form-cont' id='inviter-writer-conteiner'>
		<div id='inviter-writer-title' class='inviter-tab-title inviter-write-title inviter-form-title'
			onclick="if ($(this).hasClass('inviter-form-title')){tab_slider('writer');}"
			onmouseover="if ($(this).hasClass('inviter-form-title')){$('inviter-writer-conteiner').addClass('inviter-form-hover')}"
			onmouseout="if ($(this).hasClass('inviter-form-title')){$('inviter-writer-conteiner').removeClass('inviter-form-hover')}">
			<h3 style="padding: 20px;"><?php echo $this->translate('INVITER_Write Your Contacts')?></h3>
		</div>
		<div class='inviter-form' id='inviter-writer-form'> <?php echo $this->form_write->render($this)?> </div>
	</div>
	<?php endif; ?>
	</div>
	</div>
</div>

<?php if (!$this->form->_signup && $viewer->getIdentity() && count($this->current_suggests) > 0): ?>
  <div style="padding-top: 50px; width: 750px; padding-left:10px;">
    <div class="inviter-suggest-title">`
      <h3 style='float:left; padding-left: 10px;'><?php echo $this->translate('INVITER_People You May Know'); ?></h3>
      <?php if ($this->noneFriendCount > 0): ?>
			<div style='float:right; margin-right: 30px;' id='edit_suggest_list'>
				<a class="buttonlink menu_user_profile user_profile_edit" href="javascript:suggest.edit_suggest()" style='background-image: url("application/modules/User/externals/images/edit.png")'>
					<?php echo $this->translate('INVITER_Edit list'); ?>
				</a>
			</div>
			<?php endif; ?>
    </div>
    <div style="clear: both"></div>
    <div style="margin-right: 30px;">
      <?php echo $this->translate('INVITER_VIEWS_SCRIPTS_INDEX_SUGGEST_DESCRIPTION'); ?>
    </div>
    <br/>
    <br/>
    
   <?php echo $this->suggests ?>

	<?php elseif(count($this->current_suggests) == 0 && $this->noneFriendCount > 0): ?>
	  <br/>
    <br/>
		<div style='margin-right: 30px;' id='edit_suggest_list'>
				<a class="buttonlink menu_user_profile user_profile_edit" href="javascript:suggest.edit_suggest()" style='background-image: url("application/modules/User/externals/images/edit.png")'>
					<?php echo $this->translate('INVITER_Edit list of people you may know.'); ?>
				</a>
		</div>
	<?php endif;?>
  </div>


</div>

<div id='default_provider_list' style='display:none;'></div>